package com.zhaoyan.aopdemo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textView = findViewById(R.id.tv);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadData();
            }
        });
    }

    @AspectJAnnotation(value = "权限A")
    private void loadData() {
        Toast.makeText(this, "点击了事件", Toast.LENGTH_LONG).show();
        Intent intent = new Intent(this, Main2Activity.class);
        startActivity(intent);
    }
}
